home *** CD-ROM | disk | FTP | other *** search
- package mx.logging
- {
- import flash.events.EventDispatcher;
- import flash.system.ApplicationDomain;
- import mx.core.mx_internal;
- import mx.resources.ResourceBundle;
-
- use namespace mx_internal;
-
- public class LogLogger extends EventDispatcher implements ILogger
- {
- private static var resourceLevelLimit:String;
-
- mx_internal static const VERSION:String = "2.0.1.0";
-
- private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("logging",ApplicationDomain.currentDomain);
-
- loadResources();
-
- private var _category:String;
-
- public function LogLogger(param1:String)
- {
- super();
- _category = param1;
- }
-
- private static function loadResources() : void
- {
- resourceLevelLimit = packageResources.getString("levelLimit");
- }
-
- public function log(param1:int, param2:String, ... rest) : void
- {
- var _loc4_:uint = 0;
- if(param1 < LogEventLevel.DEBUG)
- {
- throw new ArgumentError(resourceLevelLimit);
- }
- if(hasEventListener(LogEvent.LOG))
- {
- _loc4_ = 0;
- while(_loc4_ < rest.length)
- {
- param2 = param2.replace(new RegExp("\\{" + _loc4_ + "\\}","g"),rest[_loc4_]);
- _loc4_++;
- }
- dispatchEvent(new LogEvent(param2,param1));
- }
- }
-
- public function get category() : String
- {
- return _category;
- }
-
- public function error(param1:String, ... rest) : void
- {
- var _loc3_:uint = 0;
- if(hasEventListener(LogEvent.LOG))
- {
- _loc3_ = 0;
- while(_loc3_ < rest.length)
- {
- param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
- _loc3_++;
- }
- dispatchEvent(new LogEvent(param1,LogEventLevel.ERROR));
- }
- }
-
- public function debug(param1:String, ... rest) : void
- {
- var _loc3_:uint = 0;
- if(hasEventListener(LogEvent.LOG))
- {
- _loc3_ = 0;
- while(_loc3_ < rest.length)
- {
- param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
- _loc3_++;
- }
- dispatchEvent(new LogEvent(param1,LogEventLevel.DEBUG));
- }
- }
-
- public function fatal(param1:String, ... rest) : void
- {
- var _loc3_:uint = 0;
- if(hasEventListener(LogEvent.LOG))
- {
- _loc3_ = 0;
- while(_loc3_ < rest.length)
- {
- param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
- _loc3_++;
- }
- dispatchEvent(new LogEvent(param1,LogEventLevel.FATAL));
- }
- }
-
- public function warn(param1:String, ... rest) : void
- {
- var _loc3_:uint = 0;
- if(hasEventListener(LogEvent.LOG))
- {
- _loc3_ = 0;
- while(_loc3_ < rest.length)
- {
- param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
- _loc3_++;
- }
- dispatchEvent(new LogEvent(param1,LogEventLevel.WARN));
- }
- }
-
- public function info(param1:String, ... rest) : void
- {
- var _loc3_:uint = 0;
- if(hasEventListener(LogEvent.LOG))
- {
- _loc3_ = 0;
- while(_loc3_ < rest.length)
- {
- param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
- _loc3_++;
- }
- dispatchEvent(new LogEvent(param1,LogEventLevel.INFO));
- }
- }
- }
- }
-
-